package javax.core.storage.entity;

import lombok.Data;

import java.io.Serializable;

@Data
public class SaveResultDO implements Serializable {
	private static final long serialVersionUID = -4457643686400349301L;
	private Long id;
	/**
	 * 保存结果，是否成功
	 */
	private boolean success;
	/**
	 * 保存失败的话，有失败信息
	 */
	private String message;
	/**
	 * 访问该文件的url 或 本地磁盘的绝对路径
	 */
	private String fileUri;

	public static SaveResultDO ok(String fileUri) {
		SaveResultDO result = new SaveResultDO();
		result.setSuccess(true);
		result.setFileUri(fileUri);
		return result;
	}

	public static SaveResultDO err(String message) {
		SaveResultDO result = new SaveResultDO();
		result.setSuccess(false);
		result.setMessage(message);
		return result;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getFileUri() {
		return fileUri;
	}

	public void setFileUri(String fileUri) {
		this.fileUri = fileUri;
	}
}
